home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / ImageCodec.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  10KB  |  305 lines

  1. /*
  2.      File:        ImageCodec.h
  3.  
  4.      Contains:    QuickTime Interfaces.
  5.  
  6.      Version:    Technology:    QuickTime 2.1
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __IMAGECODEC__
  19. #define __IMAGECODEC__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __QDOFFSCREEN__
  28. #include <QDOffscreen.h>
  29. #endif
  30. #ifndef __WINDOWS__
  31. #include <Windows.h>
  32. #endif
  33. #ifndef __IMAGECOMPRESSION__
  34. #include <ImageCompression.h>
  35. #endif
  36. #ifndef __COMPONENTS__
  37. #include <Components.h>
  38. #endif
  39. #ifndef __MOVIES__
  40. #include <Movies.h>
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT_SUPPORTED
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_ALIGN_SUPPORTED
  52. #pragma options align=mac68k
  53. #endif
  54.  
  55. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  56. /*    codec component selectors    */
  57.  
  58. enum {
  59.     codecGetCodecInfo            = 0x00,
  60.     codecGetCompressionTime        = 0x01,
  61.     codecGetMaxCompressionSize    = 0x02,
  62.     codecPreCompress            = 0x03,
  63.     codecBandCompress            = 0x04,
  64.     codecPreDecompress            = 0x05,
  65.     codecBandDecompress            = 0x06,
  66.     codecCDSequenceBusy            = 0x07,
  67.     codecGetCompressedImageSize    = 0x08,
  68.     codecGetSimilarity            = 0x09,
  69.     codecTrimImage                = 0x0A,
  70.     codecRequestSettings        = 0x0B,
  71.     codecGetSettings            = 0x0C,
  72.     codecSetSettings            = 0x0D,
  73.     codecCDSequenceFlush        = 0x0E,
  74.     codecSetTimeCode            = 0x0F,
  75.     codecIsImageDescriptionEquivalent = 0x10,
  76.     codecNewMemory                = 0x11,
  77.     codecDisposeMemory            = 0x12,
  78.     codecHitTestData            = 0x13
  79. };
  80.  
  81. /*    codec selectors 0-127 are reserved by Apple */
  82. /*    codec selectors 128-191 are subtype specific */
  83. /*    codec selectors 192-255 are vendor specific */
  84. /*    codec selectors 256-32767 are available for general use */
  85. /*    negative selectors are reserved by the Component Manager */
  86. /*    codec capabilities flags    */
  87.  
  88. enum {
  89.     codecCanScale                = 1L << 0,
  90.     codecCanMask                = 1L << 1,
  91.     codecCanMatte                = 1L << 2,
  92.     codecCanTransform            = 1L << 3,
  93.     codecCanTransferMode        = 1L << 4,
  94.     codecCanCopyPrev            = 1L << 5,
  95.     codecCanSpool                = 1L << 6,
  96.     codecCanClipVertical        = 1L << 7,
  97.     codecCanClipRectangular        = 1L << 8,
  98.     codecCanRemapColor            = 1L << 9,
  99.     codecCanFastDither            = 1L << 10,
  100.     codecCanSrcExtract            = 1L << 11,
  101.     codecCanCopyPrevComp        = 1L << 12,
  102.     codecCanAsync                = 1L << 13,
  103.     codecCanMakeMask            = 1L << 14,
  104.     codecCanShift                = 1L << 15,
  105.     codecCanAsyncWhen            = 1L << 16,
  106.     codecCanShieldCursor        = 1L << 17,
  107.     codecCanManagePrevBuffer    = 1L << 18,
  108.     codecHasVolatileBuffer        = 1L << 19,
  109.     codecWantsRegionMask        = 1L << 20
  110. };
  111.  
  112. struct CodecCapabilities {
  113.     long                             flags;
  114.     short                             wantedPixelSize;
  115.     short                             extendWidth;
  116.     short                             extendHeight;
  117.     short                             bandMin;
  118.     short                             bandInc;
  119.     short                             pad;
  120.     unsigned long                     time;
  121. };
  122. typedef struct CodecCapabilities CodecCapabilities;
  123.  
  124. /*    codec condition flags    */
  125.  
  126. enum {
  127.     codecConditionFirstBand        = 1L << 0,
  128.     codecConditionLastBand        = 1L << 1,
  129.     codecConditionFirstFrame    = 1L << 2,
  130.     codecConditionNewDepth        = 1L << 3,
  131.     codecConditionNewTransform    = 1L << 4,
  132.     codecConditionNewSrcRect    = 1L << 5,
  133.     codecConditionNewMask        = 1L << 6,
  134.     codecConditionNewMatte        = 1L << 7,
  135.     codecConditionNewTransferMode = 1L << 8,
  136.     codecConditionNewClut        = 1L << 9,
  137.     codecConditionNewAccuracy    = 1L << 10,
  138.     codecConditionNewDestination = 1L << 11,
  139.     codecConditionFirstScreen    = 1L << 12,
  140.     codecConditionDoCursor        = 1L << 13,
  141.     codecConditionCatchUpDiff    = 1L << 14,
  142.     codecConditionMaskMayBeChanged = 1L << 15,
  143.     codecConditionCodecChangedMask = 1L << 31
  144. };
  145.  
  146.  
  147. enum {
  148.     codecInfoResourceType        = 'cdci',                        /* codec info resource type */
  149.     codecInterfaceVersion        = 2                                /* high word returned in component GetVersion */
  150. };
  151.  
  152. struct CDSequenceDataSource {
  153.     long                             recordSize;
  154.  
  155.     void *                            next;
  156.  
  157.     ImageSequence                     seqID;
  158.     ImageSequenceDataSource         sourceID;
  159.     OSType                             sourceType;
  160.     long                             sourceInputNumber;
  161.     void *                            dataPtr;
  162.     Handle                             dataDescription;
  163.     long                             changeSeed;
  164.     ProcPtr                         transferProc;
  165.     void *                            refCon;
  166. };
  167. typedef struct CDSequenceDataSource CDSequenceDataSource;
  168.  
  169. typedef CDSequenceDataSource *CDSequenceDataSourcePtr;
  170. struct CodecCompressParams {
  171.     ImageSequence                     sequenceID;                    /* precompress,bandcompress */
  172.     ImageDescriptionHandle             imageDescription;            /* precompress,bandcompress */
  173.     Ptr                             data;
  174.     long                             bufferSize;
  175.     long                             frameNumber;
  176.     long                             startLine;
  177.     long                             stopLine;
  178.     long                             conditionFlags;
  179.     CodecFlags                         callerFlags;
  180.     CodecCapabilities *                capabilities;                /* precompress,bandcompress */
  181.     ICMProgressProcRecord             progressProcRecord;
  182.     ICMCompletionProcRecord         completionProcRecord;
  183.     ICMFlushProcRecord                 flushProcRecord;
  184.  
  185.     PixMap                             srcPixMap;                    /* precompress,bandcompress */
  186.     PixMap                             prevPixMap;
  187.     CodecQ                             spatialQuality;
  188.     CodecQ                             temporalQuality;
  189.     Fixed                             similarity;
  190.     DataRateParamsPtr                 dataRateParams;
  191.     long                             reserved;
  192.  
  193.                                                                 /* The following fields only exist for QuickTime 2.1 and greater */
  194.     UInt16                             majorSourceChangeSeed;
  195.     UInt16                             minorSourceChangeSeed;
  196.     CDSequenceDataSourcePtr         sourceData;
  197. };
  198. typedef struct CodecCompressParams CodecCompressParams;
  199.  
  200. struct CodecDecompressParams {
  201.     ImageSequence                     sequenceID;                    /* predecompress,banddecompress */
  202.     ImageDescriptionHandle             imageDescription;            /* predecompress,banddecompress */
  203.     Ptr                             data;
  204.     long                             bufferSize;
  205.     long                             frameNumber;
  206.     long                             startLine;
  207.     long                             stopLine;
  208.     long                             conditionFlags;
  209.     CodecFlags                         callerFlags;
  210.     CodecCapabilities *                capabilities;                /* predecompress,banddecompress */
  211.     ICMProgressProcRecord             progressProcRecord;
  212.     ICMCompletionProcRecord         completionProcRecord;
  213.     ICMDataProcRecord                 dataProcRecord;
  214.  
  215.     CGrafPtr                         port;                        /* predecompress,banddecompress */
  216.     PixMap                             dstPixMap;                    /* predecompress,banddecompress */
  217.     BitMapPtr                         maskBits;
  218.     PixMapPtr                         mattePixMap;
  219.     Rect                             srcRect;                    /* predecompress,banddecompress */
  220.     MatrixRecord *                    matrix;                        /* predecompress,banddecompress */
  221.     CodecQ                             accuracy;                    /* predecompress,banddecompress */
  222.     short                             transferMode;                /* predecompress,banddecompress */
  223.     ICMFrameTimePtr                 frameTime;                    /* banddecompress */
  224.     long                             reserved[1];
  225.                                                                 /* The following fields only exist for QuickTime 2.0 and greater */
  226.     SInt8                             matrixFlags;                /* high bit set if 2x resize */
  227.     SInt8                             matrixType;
  228.     Rect                             dstRect;                    /* only valid for simple transforms */
  229.                                                                 /* The following fields only exist for QuickTime 2.1 and greater */
  230.     UInt16                             majorSourceChangeSeed;
  231.     UInt16                             minorSourceChangeSeed;
  232.     CDSequenceDataSourcePtr         sourceData;
  233.  
  234.     RgnHandle                         maskRegion;
  235. };
  236. typedef struct CodecDecompressParams CodecDecompressParams;
  237.  
  238.  
  239. enum {
  240.     matrixFlagScale2x            = 1L << 7,
  241.     matrixFlagScale1x            = 1L << 6,
  242.     matrixFlagScaleHalf            = 1L << 5
  243. };
  244.  
  245. extern pascal ComponentResult CDGetCodecInfo(Handle storage, CodecInfo *info);
  246.  
  247. extern pascal ComponentResult CDGetCompressionTime(Handle storage, PixMapHandle src, const Rect *srcRect, short depth, CodecQ *spatialQuality, CodecQ *temporalQuality, unsigned long *time);
  248.  
  249. extern pascal ComponentResult CDGetMaxCompressionSize(Handle storage, PixMapHandle src, const Rect *srcRect, short depth, CodecQ quality, long *size);
  250.  
  251. extern pascal ComponentResult CDPreCompress(Handle storage, CodecCompressParams *params);
  252.  
  253. extern pascal ComponentResult CDBandCompress(Handle storage, CodecCompressParams *params);
  254.  
  255. extern pascal ComponentResult CDPreDecompress(Handle storage, CodecDecompressParams *params);
  256.  
  257. extern pascal ComponentResult CDBandDecompress(Handle storage, CodecDecompressParams *params);
  258.  
  259. extern pascal ComponentResult CDCodecBusy(Handle storage, ImageSequence seq);
  260.  
  261. extern pascal ComponentResult CDGetCompressedImageSize(Handle storage, ImageDescriptionHandle desc, Ptr data, long bufferSize, ICMDataProcRecordPtr dataProc, long *dataSize);
  262.  
  263. extern pascal ComponentResult CDGetSimilarity(Handle storage, PixMapHandle src, const Rect *srcRect, ImageDescriptionHandle desc, Ptr data, Fixed *similarity);
  264.  
  265. extern pascal ComponentResult CDTrimImage(Handle storage, ImageDescriptionHandle Desc, Ptr inData, long inBufferSize, ICMDataProcRecordPtr dataProc, Ptr outData, long outBufferSize, ICMFlushProcRecordPtr flushProc, Rect *trimRect, ICMProgressProcRecordPtr progressProc);
  266.  
  267. #endif
  268. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  269. extern pascal ComponentResult CDRequestSettings(Handle storage, Handle settings, Rect *rp, ModalFilterUPP filterProc);
  270.  
  271. #endif
  272. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  273. extern pascal ComponentResult CDGetSettings(Handle storage, Handle settings);
  274.  
  275. extern pascal ComponentResult CDSetSettings(Handle storage, Handle settings);
  276.  
  277. extern pascal ComponentResult CDCodecFlush(Handle storage);
  278.  
  279. extern pascal ComponentResult CDCodecSetTimeCode(Handle storage, void *timeCodeFormat, void *timeCodeTime);
  280.  
  281. extern pascal ComponentResult CDCodecIsImageDescriptionEquivalent(Handle storage, ImageDescriptionHandle newDesc, Boolean *equivalent);
  282.  
  283. extern pascal ComponentResult CDCodecNewMemory(Handle storage, Ptr *data, Size dataSize, long dataUse, ICMMemoryDisposedUPP memoryGoneProc, void *refCon);
  284.  
  285. extern pascal ComponentResult CDCodecDisposeMemory(Handle storage, Ptr data);
  286.  
  287. extern pascal ComponentResult CDCodecHitTestData(Handle storage, ImageDescriptionHandle desc, void *data, Size dataSize, Point where, Boolean *hit);
  288.  
  289. #endif
  290.  
  291. #if PRAGMA_ALIGN_SUPPORTED
  292. #pragma options align=reset
  293. #endif
  294.  
  295. #if PRAGMA_IMPORT_SUPPORTED
  296. #pragma import off
  297. #endif
  298.  
  299. #ifdef __cplusplus
  300. }
  301. #endif
  302.  
  303. #endif /* __IMAGECODEC__ */
  304.  
  305.